<template>
	<view class="content">
		<view class="integral-top">
			<view class="integral-top-t">
				可用积分<text >{{info.integral || 0}}</text>
			</view>
			<view class="integral-top-t">
					累计积分<text>{{info.total || 0}}</text>
			</view>
			
		</view>
		<view class="integral-tip">
			提示：每收购一公斤赠送一积分
		</view>

		<view class="integral-bottom">
			<view class='cell-group margin-cell-group'>
			
			<view  class='cell-item add-title-item jf-list-item' v-for="(item,index) in pointList" :key="index">
				<view class='cell-item-bd'>
					<view class="cell-bd-view black-text">
						<text class="cell-bd-text" style="font-size: 15px;color: #30362A;font-weight: bold;">{{item.type_text}}</text>
					</view>
					<view class="cell-bd-view">
						<text class="cell-ft-p" style="color: #FE4431;font-size: 18px;">{{item.money}}</text>
					</view>
				</view>
				<view class='cell-item-bd'>		
					<text class="cell-bd-text" style="color: #969993;">{{item.created}}</text>
				</view>
			</view>
			
			<view v-if="loadAll&&pointList.length>=10" class="no-more-data">没有更多了</view>
			<view v-if="pointList.length == 0" class="no-more-data">
			  暂无数据
			</view>	
			<!-- 	<uni-load-more
				:status="loadStatus"
				:show-icon="true"
				></uni-load-more> -->
			</view>
		</view>
	</view>
</template>

<script>
// import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue'	
export default {
	data () {
		return {
			page: 1,
			loadAll: false,
			pointList: [], // 积分记录
			info:{}
		}
	},
	components: {  },
	onLoad () {
		this.getIntegralList()
		this.getInfo()
	},
	computed: {
		
	},
	onPullDownRefresh() {
	  // console.log('下拉刷新')
	  this.loadAll = false;
	  this.pointList = [];
	  this.page = 1;
	  this.getIntegralList();
	  this.getInfo()
	},	
	// 页面滚动到底部触发事件
	onReachBottom() {
	  console.log('上拉加载')
	  if (!this.loadAll) {
	    this.getIntegralList();
	  }
	},
	methods: {
		getInfo(){
			this.$http.info().then(res => {
				console.log(res)
				this.info = res.data
			})
		},
		//反馈列表获取
		getIntegralList () {
			this.$http.integral_record({page:this.page}).then(res => {
				uni.stopPullDownRefresh()
				if(res.code == 0){
					let _list = res.data.data
					let totalPage = res.data.last_page
					if (this.page > totalPage || _list.length == 0) {
					  this.loadAll = true
					  return
					}
					if(_list.length > 0){
					  this.pointList = this.pointList.concat(_list);
					}
					this.page++;
				}
			})
		},
	},
}	
</script>

<style lang="scss" scoped>
	.content{
		width: 100%;
	}
.jf-list-item {
	display: flex;
	flex-direction: column;
	justify-content: initial;
	align-items: initial;
	.cell-item-bd {
		display: flex;
		justify-content: space-between;
		padding-right: 10rpx;
	}
}
.content{
	background-color: #fff;
	padding-top: 20upx;
}
.integral-top{
	display: flex;
	flex-direction: row;
	justify-content: space-between;
	background-color: #F8F8F8;
	align-items: center;
	padding: 10px 20px 0 20px;
}
.integral-tip{
	padding: 0 20px 15px 20px;
	color: #FE4431;
	font-size: 14px;
	background-color: #F8F8F8;
}	
.integral-top-t{
	font-size: 15px;
	color: #3B4065;
	margin-bottom: 16upx;
}
.integral-top-t text{
	color: #101010;font-size: 18px;font-weight: bold;padding-left: 10px;
}
.integral-top-n{

}
.integral-top-d{
	font-size: 22upx;
	color: #999;
}
.cell-title .cell-bd-text{
	font-size: 34upx !important;
}
.cell-bd-view{
	font-size: 22upx;
	color: #999;
}
.cell-item{
	border-bottom: 1px solid rgba(234, 234, 234, 1);
	padding: 15px 20px;
}
.cell-item .black-text .cell-bd-text{
	font-size: 28upx;
	color: #333;
}
.inte-text{
	height: 32px;
	background-color: #F9F9F9;
	line-height: 32px;
	text-align: center;
}
</style>
